﻿package com.smm.imgServer.util;
import java.awt.Color;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.MalformedURLException;

import com.lowagie.text.Cell;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Element;
import com.lowagie.text.Font;
import com.lowagie.text.HeaderFooter;
import com.lowagie.text.Image;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Phrase;
import com.lowagie.text.Rectangle;
import com.lowagie.text.Table;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.rtf.RtfWriter2;

/**
 * 根据itext提供的java类库，构建word模板，并添加相应的内容，从而导出word报告；平台不相关
 * 需要引入iText-2.1.7.jar;iTextAsian.jar;iText-rtf-2.1.7.jar
 * 
 * @author ryan
 */
public class Generate {
    private Document document;
    private BaseFont bfChinese;
    public BaseFont getBfChinese() {
        return bfChinese;
    }

    public void setBfChinese(BaseFont bfChinese) {
        this.bfChinese = bfChinese;
    }

    public Document getDocument() {
        return document;
    }

    public void setDocument(Document document) {
        this.document = document;
    }

    public Generate(){
        this.document = new Document(PageSize.A4);

    }
    /**
     * @param filePath 建立一个书写器(Writer)与document对象关联，通过书写器(Writer)可以将文档写入到磁盘中
     * @throws DocumentException
     * @throws IOException
     */
    public void openDocument(String filePath) throws DocumentException,
    IOException {
//       建立一个书写器(Writer)与document对象关联，通过书写器(Writer)可以将文档写入到磁盘中
        RtfWriter2.getInstance(this.document, new FileOutputStream(filePath));
        this.document.open();
     // 添加页眉 
     		HeaderFooter header = new HeaderFooter(new Phrase("添加页眉"), false); 
     		header.setAlignment(Rectangle.ALIGN_CENTER); 
     		document.setHeader(header);
     		// 添加页脚 
     		//（参数一）页脚的段落   和  （参数二）是否有页码 
     		HeaderFooter footer = new HeaderFooter(new Phrase("添加页脚 "), true); 
     		footer.setAlignment(Rectangle.ALIGN_CENTER); 
     		document.setFooter(footer); 
//       设置中文字体
       /* this.bfChinese = BaseFont.createFont("STSongStd-Light",
                "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);*/
    }

    /**
     * @param titleStr 标题
     * @param fontsize 字体大小
     * @param fontStyle 字体样式
     * @param elementAlign 对齐方式
     * @throws DocumentException
     */
    public void insertTitle(String titleStr,int fontsize,int fontStyle,int elementAlign) throws DocumentException{
        Font titleFont = new Font(this.bfChinese, fontsize, fontStyle);
        Paragraph title = new Paragraph(titleStr);
        // 设置标题格式对齐方式
        title.setAlignment(elementAlign);
        title.setFont(titleFont);

        this.document.add(title);
    }

    /**
     * @param contextStr 内容
     * @param fontsize 字体大小
     * @param fontStyle 字体样式
     * @param elementAlign 对齐方式
     * @throws DocumentException 
     */
    public void insertContext(String contextStr,int fontsize,int fontStyle,int elementAlign) throws DocumentException{
        // 正文字体风格
        Font contextFont = new Font(bfChinese, fontsize, fontStyle);
        Paragraph context = new Paragraph(contextStr);
        //设置行距
        context.setLeading(10f);
        // 正文格式左对齐
        context.setAlignment(elementAlign);
        context.setFont(contextFont);
        // 离上一段落（标题）空的行数
        context.setSpacingBefore(5);
        // 设置第一行空的列数
        context.setFirstLineIndent(20);
        document.add(context);
    }
    /*
     * 测试清单
     * */
    public  void insertRiskTable() throws DocumentException{
        Table aTable = new Table(6,3);
        int width[] = { 10, 40, 17, 13, 10, 10 };
        aTable.setWidths(width);// 设置每列所占比例
        aTable.setWidth(100); // 占页面宽度 90%
        aTable.setAlignment(Element.ALIGN_CENTER);// 居中显示
        aTable.setAlignment(Element.ALIGN_MIDDLE);// 纵向居中显示
        aTable.setAutoFillEmptyCells(true); // 自动填满
        aTable.setBorderWidth(0); // 边框宽度
        aTable.setBorderColor(new Color(0, 125, 255)); // 边框颜色
        aTable.setPadding(2);// 衬距，看效果就知道什么意思了
        aTable.setSpacing(3);// 即单元格之间的间距
        aTable.setBorder(2);// 边框

        Font fontChinese = new Font(bfChinese, 10, Font.BOLD);
        Cell cell = new Cell(new Phrase("\n测试代码\n", fontChinese));
        cell.setVerticalAlignment(Element.ALIGN_CENTER);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setBorderColor(new Color(0, 0, 0));
        cell.setBackgroundColor(new Color(153, 204, 255));
        aTable.addCell(cell);

        Cell cell1 = new Cell(new Phrase("测试名称", fontChinese));
        cell1.setVerticalAlignment(Element.ALIGN_CENTER);
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell1.setBorderColor(new Color(0, 0, 0));
        cell1.setBackgroundColor(new Color(153, 204, 255));
        aTable.addCell(cell1);

        Cell cell2 = new Cell(new Phrase("测试发生可能性", fontChinese));
        cell2.setVerticalAlignment(Element.ALIGN_CENTER);
        cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell2.setBorderColor(new Color(0, 0, 0));
        cell2.setBackgroundColor(new Color(255, 255, 0));
        aTable.addCell(cell2);

        Cell cell3 = new Cell(new Phrase("测试损失度", fontChinese));
        cell3.setVerticalAlignment(Element.ALIGN_CENTER);
        cell3.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell3.setBorderColor(new Color(0, 0, 0));
        cell3.setBackgroundColor(new Color(255, 255, 0));
        aTable.addCell(cell3);

        Cell cell4 = new Cell(new Phrase("测试水平", fontChinese));
        cell4.setVerticalAlignment(Element.ALIGN_CENTER);
        cell4.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell4.setBorderColor(new Color(0, 0, 0));
        cell4.setBackgroundColor(new Color(255, 255, 0));
        aTable.addCell(cell4);

        Cell cell5 = new Cell(new Phrase("测试等级", fontChinese));
        cell5.setVerticalAlignment(Element.ALIGN_CENTER);
        cell5.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell5.setBorderColor(new Color(0, 0, 0));
        cell5.setBackgroundColor(new Color(255, 255, 0));
        aTable.addCell(cell5);

        for(int i=0;i<12;i++){
            aTable.addCell(new Cell(i+""));
        }       
        document.add(aTable);
        document.add(new Paragraph("\n"));  
    }
    /*
     * 现状评估
     * */
    public void insertRiskEvaluationTable() throws DocumentException{
        Table aTable = new Table(4,7);
        int width1[] = { 5, 20, 8, 25};
        aTable.setWidths(width1);// 设置每列所占比例
        aTable.setWidth(100); // 占页面宽度 90%
        aTable.setAlignment(Element.ALIGN_CENTER);// 居中显示
        aTable.setAlignment(Element.ALIGN_MIDDLE);// 纵向居中显示
        aTable.setAutoFillEmptyCells(true); // 自动填满
        aTable.setBorderWidth(0); // 边框宽度
        aTable.setBorderColor(new Color(0, 125, 255)); // 边框颜色

        Font fontChinese = new Font(bfChinese, 10, Font.BOLD);
        Cell cell11 = new Cell(new Phrase("教学环节", fontChinese));
        cell11.setVerticalAlignment(Element.ALIGN_CENTER);
        cell11.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell11.setColspan(2);
        cell11.setBorderColor(new Color(0, 0, 0));
        cell11.setBackgroundColor(new Color(153, 204, 255));
        aTable.addCell(cell11);

        Cell cell12 = new Cell(new Phrase("时间（分钟）", fontChinese));
        cell12.setVerticalAlignment(Element.ALIGN_CENTER);
        cell12.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell12.setRowspan(1);
        cell12.setBorderColor(new Color(0, 0, 0));
        cell12.setBackgroundColor(new Color(153, 204, 255));
        aTable.addCell(cell12);

        Cell cell13 = new Cell(new Phrase("教学活动", fontChinese));
        cell13.setVerticalAlignment(Element.ALIGN_CENTER);
        cell13.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell13.setRowspan(1);
        cell13.setBorderColor(new Color(0, 0, 0));
        cell13.setBackgroundColor(new Color(153, 204, 255));
        aTable.addCell(cell13);
        
        
        Font fontChinesecontent = new Font(bfChinese, 10, Font.BOLD);
        Cell cell21 = new Cell(new Phrase("课程引入、学习目标分析", fontChinesecontent));
        cell21.setVerticalAlignment(Element.ALIGN_CENTER);
        cell21.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell21.setColspan(2);
        cell21.setBorderColor(new Color(0, 0, 0));
        aTable.addCell(cell21);

        Cell cell22 = new Cell(new Phrase("5", fontChinesecontent));
        cell22.setVerticalAlignment(Element.ALIGN_CENTER);
        cell22.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell22.setRowspan(1);
        cell22.setBorderColor(new Color(0, 0, 0));
        aTable.addCell(cell22);

        Cell cell23 = new Cell(new Phrase("教师设问，播放课件，学生讨论", fontChinesecontent));
        cell23.setVerticalAlignment(Element.ALIGN_CENTER);
        cell23.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell23.setRowspan(1);
        cell23.setBorderColor(new Color(0, 0, 0));
        aTable.addCell(cell23);

        Cell cell31 = new Cell(new Phrase("新课\n讲解\n技能\n训练", fontChinesecontent));
        cell31.setVerticalAlignment(Element.ALIGN_CENTER);
        cell31.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell31.setRowspan(2);
        cell31.setBorderColor(new Color(0, 0, 0));
        aTable.addCell(cell31);

        Cell cell32 = new Cell(new Phrase("？？？", fontChinesecontent));
        cell32.setVerticalAlignment(Element.ALIGN_CENTER);
        cell32.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell32.setRowspan(1);
        cell32.setBorderColor(new Color(0, 0, 0));
        aTable.addCell(cell32);

        Cell cell33 = new Cell(new Phrase("9", fontChinesecontent));
        cell33.setVerticalAlignment(Element.ALIGN_CENTER);
        cell33.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell33.setRowspan(1);
        cell33.setBorderColor(new Color(0, 0, 0));
        aTable.addCell(cell33);
        
        Cell cell34 = new Cell(new Phrase("教师讲解，学生讨论", fontChinesecontent));
        cell34.setVerticalAlignment(Element.ALIGN_CENTER);
        cell34.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell34.setRowspan(1);
        cell34.setBorderColor(new Color(0, 0, 0));
        aTable.addCell(cell34);
        
        Cell cell41 = new Cell(new Phrase("？？？", fontChinesecontent));
        cell41.setVerticalAlignment(Element.ALIGN_CENTER);
        cell41.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell41.setRowspan(1);
        cell41.setBorderColor(new Color(0, 0, 0));
        aTable.addCell(cell41);
        
        Cell cell42 = new Cell(new Phrase("15", fontChinesecontent));
        cell42.setVerticalAlignment(Element.ALIGN_CENTER);
        cell42.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell42.setRowspan(1);
        cell42.setBorderColor(new Color(0, 0, 0));
        aTable.addCell(cell42);
        
        Cell cell43 = new Cell(new Phrase("？？？", fontChinesecontent));
        cell43.setVerticalAlignment(Element.ALIGN_CENTER);
        cell43.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell43.setRowspan(1);
        cell43.setBorderColor(new Color(0, 0, 0));
        aTable.addCell(cell43);
        
        Cell cell51 = new Cell(new Phrase("课程小结", fontChinesecontent));
        cell51.setVerticalAlignment(Element.ALIGN_CENTER);
        cell51.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell51.setColspan(2);
        cell51.setBorderColor(new Color(0, 0, 0));
        aTable.addCell(cell51);
        
        Cell cell52 = new Cell(new Phrase("5", fontChinesecontent));
        cell52.setVerticalAlignment(Element.ALIGN_CENTER);
        cell52.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell52.setRowspan(1);
        cell52.setBorderColor(new Color(0, 0, 0));
        aTable.addCell(cell52);
        
        Cell cell53 = new Cell(new Phrase("学生讨论归纳，教师点评", fontChinesecontent));
        cell53.setVerticalAlignment(Element.ALIGN_CENTER);
        cell53.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell53.setRowspan(1);
        cell53.setBorderColor(new Color(0, 0, 0));
        aTable.addCell(cell53);
        
        Cell cell61 = new Cell(new Phrase("过程评价", fontChinesecontent));
        cell61.setVerticalAlignment(Element.ALIGN_CENTER);
        cell61.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell61.setColspan(2);
        cell61.setBorderColor(new Color(0, 0, 0));
        aTable.addCell(cell61);
        
        Cell cell62 = new Cell(new Phrase("3", fontChinesecontent));
        cell62.setVerticalAlignment(Element.ALIGN_CENTER);
        cell62.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell62.setRowspan(1);
        cell62.setBorderColor(new Color(0, 0, 0));
        aTable.addCell(cell62);
        
        Cell cell63 = new Cell(new Phrase("学生自评和互评，教师评价在巡视中完成课堂表现部分，其余在课后补充完整", fontChinesecontent));
        cell63.setVerticalAlignment(Element.ALIGN_CENTER);
        cell63.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell63.setRowspan(1);
        cell63.setBorderColor(new Color(0, 0, 0));
        aTable.addCell(cell63);
        
        Cell cell71 = new Cell(new Phrase("作业布置", fontChinesecontent));
        cell71.setVerticalAlignment(Element.ALIGN_CENTER);
        cell71.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell71.setColspan(2);
        cell71.setBorderColor(new Color(0, 0, 0));
        aTable.addCell(cell71);
        
        Cell cell72 = new Cell(new Phrase("3", fontChinesecontent));
        cell72.setVerticalAlignment(Element.ALIGN_CENTER);
        cell72.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell72.setRowspan(1);
        cell72.setBorderColor(new Color(0, 0, 0));
        aTable.addCell(cell72);
        
        Cell cell73 = new Cell(new Phrase("教师布置课后作业（功能改进），或下发任务单。学生按要求完成", fontChinesecontent));
        cell73.setVerticalAlignment(Element.ALIGN_CENTER);
        cell73.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell73.setRowspan(1);
        cell73.setBorderColor(new Color(0, 0, 0));
        aTable.addCell(cell73);
        
        document.add(aTable);
        document.add(new Paragraph("\n"));
    }

    /*
     * 测试控制清单
     * */
    public  void insertRiskControlTable() throws DocumentException{
        Table aTable = new Table(11,3);
        int width[] = { 5, 13, 5, 9, 9, 13, 9, 9, 9, 9, 9 };
        aTable.setWidths(width);// 设置每列所占比例
        aTable.setWidth(100); // 占页面宽度 90%
        aTable.setAlignment(Element.ALIGN_CENTER);// 居中显示
        aTable.setAlignment(Element.ALIGN_MIDDLE);// 纵向居中显示
        aTable.setAutoFillEmptyCells(true); // 自动填满
        aTable.setBorderWidth(0); // 边框宽度
        aTable.setBorderColor(new Color(0, 125, 255)); // 边框颜色

        Font fontChinese = new Font(bfChinese, 10, Font.BOLD);
        Cell cell = new Cell(new Phrase("\n测试代码\n", fontChinese));
        cell.setVerticalAlignment(Element.ALIGN_CENTER);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setBorderColor(new Color(0, 0, 0));
        cell.setBackgroundColor(new Color(204, 153, 255));
        aTable.addCell(cell);

        Cell cell1 = new Cell(new Phrase("测试名称", fontChinese));
        cell1.setVerticalAlignment(Element.ALIGN_CENTER);
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell1.setBorderColor(new Color(0, 0, 0));
        cell1.setBackgroundColor(new Color(204, 153, 255));
        aTable.addCell(cell1);

        Cell cell2 = new Cell(new Phrase("行为代码", fontChinese));
        cell2.setVerticalAlignment(Element.ALIGN_CENTER);
        cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell2.setBorderColor(new Color(0, 0, 0));
        cell2.setBackgroundColor(new Color(204, 153, 255));
        aTable.addCell(cell2);

        Cell cell3 = new Cell(new Phrase("引发测试的行为", fontChinese));
        cell3.setVerticalAlignment(Element.ALIGN_CENTER);
        cell3.setBorderColor(new Color(0, 0, 0));
        cell3.setBackgroundColor(new Color(204, 153, 255));
        aTable.addCell(cell3);

        Cell cell4 = new Cell(new Phrase("测试控制态度", fontChinese));
        cell4.setVerticalAlignment(Element.ALIGN_CENTER);
        cell4.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell4.setBorderColor(new Color(0, 0, 0));
        cell4.setBackgroundColor(new Color(204, 153, 255));
        aTable.addCell(cell4);

        Cell cell5 = new Cell(new Phrase("控制措施", fontChinese));
        cell5.setVerticalAlignment(Element.ALIGN_CENTER);
        cell5.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell5.setBorderColor(new Color(0, 0, 0));
        cell5.setBackgroundColor(new Color(204, 153, 255));
        aTable.addCell(cell5);

        Cell cell6 = new Cell(new Phrase("措施类型", fontChinese));
        cell6.setVerticalAlignment(Element.ALIGN_CENTER);
        cell6.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell6.setBorderColor(new Color(0, 0, 0));
        cell6.setBackgroundColor(new Color(204, 153, 255));
        aTable.addCell(cell6);

        Cell cell7 = new Cell(new Phrase("完成标志", fontChinese));
        cell7.setVerticalAlignment(Element.ALIGN_CENTER);
        cell7.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell7.setBorderColor(new Color(0, 0, 0));
        cell7.setBackgroundColor(new Color(204, 153, 255));
        aTable.addCell(cell7);

        Cell cell8 = new Cell(new Phrase("控制措施完成时间", fontChinese));
        cell8.setVerticalAlignment(Element.ALIGN_CENTER);
        cell8.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell8.setBorderColor(new Color(0, 0, 0));
        cell8.setBackgroundColor(new Color(204, 153, 255));
        aTable.addCell(cell8);

        Cell cell9 = new Cell(new Phrase("控制措施牵头部门", fontChinese));
        cell9.setVerticalAlignment(Element.ALIGN_CENTER);
        cell9.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell9.setBorderColor(new Color(0, 0, 0));
        cell9.setBackgroundColor(new Color(204, 153, 255));
        aTable.addCell(cell9);

        Cell cell10 = new Cell(new Phrase("控制措施配合部门", fontChinese));
        cell10.setVerticalAlignment(Element.ALIGN_CENTER);
        cell10.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell10.setBorderColor(new Color(0, 0, 0));
        cell10.setBackgroundColor(new Color(204, 153, 255));
        aTable.addCell(cell10);

        for(int i=0;i<22;i++){
            aTable.addCell(new Cell(i+""));
        }

        document.add(aTable);
        document.add(new Paragraph("\n"));

    }

    /**
     * @param imgUrl 图片路径
     * @param imageAlign 显示位置
     * @param height 显示高度
     * @param weight 显示宽度
     * @param percent 显示比例
     * @param heightPercent 显示高度比例
     * @param weightPercent 显示宽度比例
     * @param rotation 显示图片旋转角度
     * @throws MalformedURLException
     * @throws IOException
     * @throws DocumentException
     */
    public void insertImg(String imgUrl,int imageAlign,int height,int weight,int percent,int heightPercent,int weightPercent,int rotation) throws MalformedURLException, IOException, DocumentException{
//       添加图片
        Image img = Image.getInstance(imgUrl);
        if(img==null)
            return;
        img.setAbsolutePosition(0, 0);
        img.setAlignment(imageAlign);
        img.scaleAbsolute(height, weight);
        img.scalePercent(percent);
        img.scalePercent(heightPercent, weightPercent);
        img.setRotation(rotation);

        document.add(img);
    }

    public void closeDocument() throws DocumentException{
        this.document.close();
    }

    public static void main(String[] args) throws DocumentException, IOException {
        Generate wt = new Generate();
        wt.openDocument("D:\\dome1.doc");
        wt.insertTitle("面向对象编程基础（Java）教案设计", 18, Font.BOLD, Element.ALIGN_CENTER);
        wt.insertTitle("\n", 12, Font.BOLD, Element.ALIGN_LEFT);
        wt.insertTitle("吴新星", 10, Font.NORMAL, Element.ALIGN_RIGHT);
        wt.insertTitle("2014年10月19日", 10, Font.NORMAL, Element.ALIGN_RIGHT);
        wt.insertContext("\t 本次课的教学内容为", 12, Font.NORMAL, Element.ALIGN_LEFT);
        
        wt.insertTitle("\t 一、教学说明", 12, Font.BOLD, Element.ALIGN_LEFT);
        wt.insertContext("\t 1、要完成本次课的教学，教师应准备如下材料：", 12, Font.NORMAL, Element.ALIGN_LEFT);
        wt.insertContext("\t 教材、进度表、大纲、课表、在线Web资源、多媒体课件、", 12, Font.NORMAL, Element.ALIGN_LEFT);
        wt.insertContext("\t 2、学生应具备的基础：", 12, Font.NORMAL, Element.ALIGN_LEFT);
        wt.insertContext("\t 1) 完成", 12, Font.NORMAL, Element.ALIGN_LEFT);
        wt.insertContext("\t 2) 具备", 12, Font.NORMAL, Element.ALIGN_LEFT);
        
        wt.insertContext("\t 二、教学目的", 12, Font.BOLD, Element.ALIGN_LEFT);
        wt.insertContext("\t 通过本次课的学习，要求学生达到以下知识和能力目标。", 12, Font.NORMAL, Element.ALIGN_LEFT);
        wt.insertContext("\t 1、知识目标", 12, Font.NORMAL, Element.ALIGN_LEFT);
        wt.insertContext("\t 1) 能完全理解", 12, Font.NORMAL, Element.ALIGN_LEFT);
        wt.insertContext("\t 2) 能利用所学知识", 12, Font.NORMAL, Element.ALIGN_LEFT);
        
        wt.insertContext("\t 2、能力目标", 12, Font.NORMAL, Element.ALIGN_LEFT);
        wt.insertContext("\t 1) 能准确分析", 12, Font.NORMAL, Element.ALIGN_LEFT);
        
        wt.insertContext("\t 3、素质目标", 12, Font.NORMAL, Element.ALIGN_LEFT);
        wt.insertContext("\t 1) 具备查阅资料的能力；", 12, Font.NORMAL, Element.ALIGN_LEFT);
        wt.insertContext("\t 2) 具备独立工作或团队合作的能力；", 12, Font.NORMAL, Element.ALIGN_LEFT);
        wt.insertContext("\t 3) 具备精益求精、严谨求实的工作态度；", 12, Font.NORMAL, Element.ALIGN_LEFT);
        wt.insertContext("\t 4) 具备良好的职业道德和素质。", 12, Font.NORMAL, Element.ALIGN_LEFT);
        
        wt.insertTitle("\t 三、教学重点和难点分析", 12, Font.BOLD, Element.ALIGN_LEFT);
        wt.insertContext("\t 1、教学重点", 12, Font.NORMAL, Element.ALIGN_LEFT);
        wt.insertContext("\t 知识点。", 12, Font.NORMAL, Element.ALIGN_LEFT);
        wt.insertContext("\t 2、教学难点", 12, Font.NORMAL, Element.ALIGN_LEFT);
        wt.insertContext("\t 知识点。", 12, Font.NORMAL, Element.ALIGN_LEFT);
        
        wt.insertTitle("\t 四、教学思想", 12, Font.BOLD, Element.ALIGN_LEFT);
        wt.insertTitle("\t 本次课是上次课的应用和延伸，重在对学生排故能力的训练，需要教师在安装好的电路上预先设置典型故障，让学生通过观察故障现象、分组讨论故障原因和范围，并最终利用万用表排除故障。排故能力的训练，可为后续复杂项目的开展，及今后学生获取维修电工中级职业资格书打好基础。", 12, Font.NORMAL, Element.ALIGN_LEFT);
        wt.insertContext("\t 为了巩固知识，在讲授过程中教师要让学生同步完成配套的工作页。", 12, Font.NORMAL, Element.ALIGN_LEFT);
        
        wt.insertTitle("\t 五、教学过程和教学方法设计", 12, Font.BOLD, Element.ALIGN_LEFT);
        wt.insertContext("\t 教学过程采用“教学做一体化”的方式开展，辅以多媒体课件、实物操作、Flash动画、分析讨论、习题训练等教学手段。", 12, Font.NORMAL, Element.ALIGN_LEFT);
        wt.insertContext("\t 整个教学过程分为以下四个阶段：", 12, Font.NORMAL, Element.ALIGN_LEFT);
        wt.insertContext("\t 1、课程引入：", 12, Font.NORMAL, Element.ALIGN_LEFT);
        wt.insertContext("\t 2、知识和技能训练：", 12, Font.NORMAL, Element.ALIGN_LEFT);
        wt.insertContext("\t 3、课堂操作：", 12, Font.NORMAL, Element.ALIGN_LEFT);
        wt.insertContext("\t 4、任务总结、过程评价、作业布置：", 12, Font.NORMAL, Element.ALIGN_LEFT);
        
        wt.insertTitle("\t 五、教学过程和教学方法设计", 12, Font.BOLD, Element.ALIGN_LEFT);
        
        wt.insertContext("① 部门角度测试分析", 12, Font.NORMAL, Element.ALIGN_LEFT);
        wt.insertImg("Desert.jpg", Image.ALIGN_CENTER, 12, 35, 50, 50, 50, 30);
        wt.insertContext("② 主体角度测试分析", 12, Font.NORMAL, Element.ALIGN_LEFT);
        wt.insertImg("Desert.jpg", Image.ALIGN_CENTER, 12, 35, 50, 60, 60, 30);
        wt.insertContext("③ 部门主体交叉角度测试分析", 12, Font.NORMAL, Element.ALIGN_LEFT);
        wt.insertImg("Desert.jpg", Image.ALIGN_CENTER, 50, 75, 100, 100, 100, 30);
        wt.insertContext("④ 业务活动角度测试分析", 12, Font.NORMAL, Element.ALIGN_LEFT);
        wt.insertImg("Desert.jpg", Image.ALIGN_CENTER, 12, 35, 50, 80, 80, 30);

        wt.insertTitle("二、重大测试清单", 12, Font.BOLD, Element.ALIGN_CENTER);
        wt.insertRiskTable();
        wt.insertTitle("三、测试控制现状评估结果", 12, Font.BOLD, Element.ALIGN_CENTER);
        wt.insertRiskEvaluationTable();
        wt.insertTitle("四、测试控制计划", 12, Font.BOLD, Element.ALIGN_CENTER);
        wt.insertRiskControlTable();
        wt.closeDocument();
    }
}